<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%><%@include file="/web/base/header.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>登录</title>
</head>
<body>
		<fieldset class="layui-elem-field layui-field-title">
		<legend>登录</legend>
		<div class="layui-field-box">
			<form class="layui-form">
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-inline">
						<input type="text" name="username" lay-verify="required"
							placeholder="请输入用户名" autocomplete="off" class="layui-input">
					</div>
				</div>


				<div class="layui-form-item">
					<label class="layui-form-label">密码框</label>
					<div class="layui-input-inline">
						<input type="password" name="password" lay-verify="required"
							lay-verify="required" placeholder="请输入密码" autocomplete="off"
							class="layui-input">
					</div>
				</div>
				
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="loginbut">登录</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						
					</div>
				
				
				<input name="action" type="hidden" value="login" />

			</form>
			<button id="goregister" class="layui-btn">前往注册</button>
		</div>
	</fieldset>
	
	<script type="text/javascript">
	$("#goregister").click(goregister);
// 	console.log("11");
	formon('submit(loginbut)',base.app+'/UserServlet','text',
			function fun(data) {
				
				if("2"==data){
					alert("未找到用户");
					$(window).attr('location',base.app+"/web/login.jsp");
				}
				if("3"==data){
					alert("密码错误");					
					$(window).attr('location',base.app+"/web/login.jsp");
				}
				if("1"==data){
					layer.msg("登陆成功",function(){
						$(window).attr('location',base.app+"/web/page/welcome.jsp");
					});
				}
			});
	
	function goregister() {
		location.href = base.app+"/web/register.jsp";
	}
	</script>
</body>
</html>